﻿#pragma once

#include "../MirEnvir/Envir.h"
#include "CharacterInfo.h"
#include "../../Shared/Data/ItemData.h"
#include "../../Shared/Data/ClientData.h"
#include <string>
#include <vector>

using namespace Server::MirDatabase;
using namespace Server::MirObjects;

namespace Server::MirEnvir
{
    class MailInfo
    {
    public:
        virtual ~MailInfo()
        {
            delete RecipientInfo;
        }

    protected:
        static Server::MirEnvir::Envir *getEnvir();

    public:
        unsigned long long MailID = 0;

        std::string Sender;

        int RecipientIndex = 0;
        CharacterInfo *RecipientInfo;

        std::string Message = std::string::Empty;
        unsigned int Gold = 0;
        std::vector<UserItem*> Items = std::vector<UserItem*>();

        DateTime DateSent, DateOpened;

        bool getSent() const;

        bool getOpened() const;

        bool Locked = false;

        bool Collected = false;

        bool getParcel() const;

        bool CanReply = false;

        MailInfo(int recipientIndex, bool canReply = false);

        MailInfo(BinaryReader *reader, int version, int customversion);

        void Save(BinaryWriter *writer);

        void Send();

        ClientMail *CreateClientMail();
    };

    // player bool NewMail (process in envir loop) - send all mail on login

    // Send mail from player (auto from player)
    // Send mail from Envir (mir administrator)
}
